package com.manong.util;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
public class JsonResult {
    private Integer code;
    private String msg;
    private String status;
    private Object data;

    public JsonResult(Integer code, Object data, String status, String msg) {
        this.code = code;
        this.data = data;
        this.status = status;
        this.msg = msg;
    }

    public static JsonResult success() {
        return new JsonResult(200, null, "true", "操作成功");
    }
    public static JsonResult success(Object data) {
        return new JsonResult(200, data, "true", "操作成功");
    }
    public static JsonResult fail() {
        return new JsonResult(500, null, "false", "操作失败");
    }
    public static JsonResult fail(String msg) {
        return new JsonResult(500, msg, "false", "操作失败");
    }

}
